<?php
namespace app\admin\controller;
use think\Controller;
use think\Cookie;
use think\Request;
use think\Session;
class  Base extends Controller {

    public $uid;
    public $chineseName;
    public $img;


    function __construct(Request $request = null)
    {
        parent::__construct($request);
        //检测登录
        header("Content-type:text/html;charset=utf-8");
        $this->uid = Session::get('adminUid')?Session::get('adminUid'):Cookie::get('adminUid');

        if(!$this->uid){
            $from = Request::instance()->url(true);
            Session::set('urlFrom',$from);
            $this->redirect('admin/login/login');
        }
        $loginInfo = model('admin')->where('id',$this->uid)->find();
        $this->assign('active_action',\request()->action());
        $this->assign('chineseName',$loginInfo->chinesename);
        $this->assign('img',$loginInfo->img);
        $this->assign('post',$loginInfo->post);
        $this->assign('min_profit', getSettingValue('min_profit')?getSettingValue('min_profit'):20);
    }


















}